<template>
	<view class="main">
		<view class="exchange-box">
			<input class="uni-input" v-model:value="code" focus placeholder="请输入兑换码" />
			<button type="primary" @click="confirm">确定</button>
		</view>
	</view>
</template>

<script>
	import {
		exchangeVip
	} from "@/api/index.js"
	export default {
		data() {
			return {
				code: ''
			};
		},
		methods: {
			confirm() {
				let params = {
					key: this.code
				}
				exchangeVip(params).then(res => {
					if (res.code == 0) {
						uni.showToast({
							icon: 'none',
							title: res.msg,
							duration: 2000
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.main {
		background-color: #fff;
		box-sizing: border-box;
	}

	.exchange-box {
		padding: 26rpx;
	}

	.uni-input {
		border: 1px solid #eee;
		padding: 14rpx 26rpx;
		font-size: 26rpx;
		margin-bottom: 30px;
		border-radius: 30px;
	}
</style>